﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    
      xmlns:Properties="clr-namespace:YalvLib.Strings"
      xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"

                    xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
                    xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">

    <ResourceDictionary.MergedDictionaries>
        <!-- Default styles setup -->
        <ResourceDictionary Source="/YalvLib;component/Themes/Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- DATAGRID -->
    <Style x:Key="DefaultDataGridStyle" TargetType="{x:Type DataGrid}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="RowHeight" Value="20" />
        <Setter Property="IsReadOnly" Value="True" />
        <Setter Property="HeadersVisibility" Value="Column" />
        <Setter Property="VerticalGridLinesBrush" Value="#8C6C6C6C" />
        <Setter Property="HorizontalGridLinesBrush" Value="White" />
        <Setter Property="AutoGenerateColumns" Value="False" />
        <Setter Property="SelectionMode" Value="Extended" />
        <Setter Property="SelectionUnit" Value="FullRow" />
        <Setter Property="CanUserAddRows" Value="False" />
        <Setter Property="CanUserDeleteRows" Value="False" />
        <Setter Property="CanUserReorderColumns" Value="False" />
        <Setter Property="CanUserResizeColumns" Value="True" />
        <Setter Property="CanUserSortColumns" Value="True" />
        <Setter Property="ClipboardCopyMode" Value="ExcludeHeader" />
        <Setter Property="Foreground" Value="{StaticResource DefaultForegroundColor}" />
        <Style.Triggers>
            <Trigger Property="HeadersVisibility" Value="Column">
                <!-- Workaround datagrid bug; refs: http://wpf.codeplex.com/discussions/47047 -->
                <Setter Property="RowHeaderWidth" Value="0" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="DefaultColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="SizeWE" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DefaultDataGridHeaderStyle" TargetType="DataGridColumnHeader">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
        <Setter Property="Background" Value="{StaticResource GrayGradientBackground}" />
        <Setter Property="Foreground" Value="{StaticResource DefaultForegroundColor}" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="Height" Value="20" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Themes:DataGridHeaderBorder
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            IsClickable="{TemplateBinding CanUserSort}"
                            IsPressed="{TemplateBinding IsPressed}"
                            IsHovered="{TemplateBinding IsMouseOver}"
                            Padding="{TemplateBinding Padding}"
                            SortDirection="{TemplateBinding SortDirection}"
                            SeparatorBrush="{TemplateBinding SeparatorBrush}"
                            SeparatorVisibility="{TemplateBinding SeparatorVisibility}">
                            <Grid>
                                <ContentPresenter x:Name="PART_ContentPresenter"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                                <Path x:Name="SortArrow"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      Margin="2,1,2,0"
                      Width="8"
                      Height="6"
                      Stretch="Fill"
                      Opacity="0.5"
                      Fill="White"
                      RenderTransformOrigin="0.5,0.4"
                      Visibility="Collapsed"
                      Data="M0,0 L1,0 0.5,1 z" />
                            </Grid>
                        </Themes:DataGridHeaderBorder>
                        <Thumb
                            x:Name="PART_LeftHeaderGripper"
                            HorizontalAlignment="Left"
                            Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
                        <Thumb
                            x:Name="PART_RightHeaderGripper"
                            HorizontalAlignment="Right"
                            Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Left">
                            <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="3,0,0,0" />
                        </Trigger>
                        <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Right">
                            <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="0,0,3,0" />
                        </Trigger>
                        <Trigger
                            Property="SortDirection"
                            Value="Ascending">
                            <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
                            <Setter
                                TargetName="SortArrow"
                                Property="RenderTransform">
                                <Setter.Value>
                                    <RotateTransform
                                        Angle="180" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger
                            Property="SortDirection"
                            Value="Descending">
                            <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DefaultDataGridCellStyle" TargetType="DataGridCell">
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground"
                Value="{StaticResource DefaultForegroundColor}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="CenterDataGridCellStyle" BasedOn="{StaticResource DefaultDataGridCellStyle}" TargetType="DataGridCell">
        <Style.Setters>
            <Setter Property="TextBlock.TextAlignment" Value="Center" />
        </Style.Setters>
    </Style>

    <Style x:Key="LogItemDataGridRowStyle" TargetType="{x:Type DataGridRow}">
        <Setter Property="ToolTip">
            <!-- Show details data on mouse over row -->
            <Setter.Value>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Class_Text}" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.Class, Mode=OneWay}"                                Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left"  Margin="3" />

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Method_Text}"  Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.Method, Mode=OneWay}"                                 Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_File_Text}" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.File, Mode=OneWay}"                                Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Line_Text}" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.Line, Mode=OneWay}"                                Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Thread_Text}" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.Thread, Mode=OneWay}"                                Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_TimeStamp_Text}" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.TimeStamp, Mode=OneWay, StringFormat={}{0:MM/dd/yyyy hh:mm tt}}"  Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>
                    
                    <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_TimeDiff_Text}" Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
                    <TextBlock Text="{Binding Path=Entry.Delta, Mode=OneWay}"                                   Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>
                </Grid>
            </Setter.Value>
        </Setter>
        <Style.Triggers>

            <!-- Debug -->
            <DataTrigger Binding="{Binding Path=Entry.LevelIndex, Mode=OneWay}" Value="1">
                <Setter Property="Background" Value="{StaticResource DebugLevelColor}" />
            </DataTrigger>

            <!-- Info -->
            <DataTrigger Binding="{Binding Path=Entry.LevelIndex, Mode=OneWay}" Value="2">
                <Setter Property="Background" Value="{StaticResource InfoLevelColor}" />
            </DataTrigger>

            <!-- Warn -->
            <DataTrigger Binding="{Binding Path=Entry.LevelIndex, Mode=OneWay}" Value="3">
                <Setter Property="Background" Value="{StaticResource WarnLevelColor}" />
            </DataTrigger>

            <!-- Error -->
            <DataTrigger Binding="{Binding Path=Entry.LevelIndex, Mode=OneWay}" Value="4">
                <Setter Property="Background" Value="{StaticResource ErrorLevelColor}" />
            </DataTrigger>

            <!-- Fatal -->
            <DataTrigger Binding="{Binding Path=Entry.LevelIndex, Mode=OneWay}" Value="5">
                <Setter Property="Background" Value="{StaticResource FatalLevelColor}" />
            </DataTrigger>

        </Style.Triggers>
    </Style>

</ResourceDictionary>